/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package tankproject;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/**
 *
 * @author Kevin
 */
public class Vehicle {
    
    private Game game;
    private Image body; 
    private int xPos;
    private int yPos;
    
    public Vehicle (Game game, int x, int y){
        this.game=game;
        xPos=x;
        yPos=y;
        initImages();
    }
            
    private void initImages() {
        body = getImage("Vehicle.png");     
    }

    private Image getImage(String imageName) {
        try {
            return ImageIO.read(new File("images/"+imageName));
        } catch (IOException e) {e.printStackTrace();}
        return null;
    }
    public void paint(Graphics g) {
        paintBody(g.create());
    }
    private void paintBody(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g.drawImage(body, xPos, yPos, game);
    }
}
